<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" trimDirectiveWhitespaces="true"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib prefix="ctp" uri="http://www.seeyon.com/ctp"%>
<c:set var="path" value="${pageContext.request.contextPath}" />
   
 setTimeout("initJiaBan()",1200);
function isEmptyString(strIn) {
    if (strIn === undefined) {
        return true;
    } else if (strIn == null) {
        return true;
    } else if (strIn == "") {
        return true;
    } else {
        return false;
    }
}
function initJiaBan() {

	window.thirdPartyFormAPI.registerEvent('afterFormFieldChange',
			function(event) {				
				if (event.display == '开始时间'||event.display == '结束时间') {
				    var params =[];
				    var _formData= window.thirdPartyFormAPI.getFormData();
					var _records=_formData.formsons.front_formson_1.records;
					for(var num=0;num < _records.length;num++){
					  var _startCtl=  _records[num].lists.field0012;
					  var _endCtl=  _records[num].lists.field0013; 
					  if(!isEmptyString(_startCtl.value)&&!isEmptyString(_endCtl.value)){
					      var _startdate=_startCtl.value;
					      var _startday=_startdate.substr(0,10);
					       var _enddate=_endCtl.value;
					      var _endday=_enddate.substr(0,10);
					      var _xq=new Date(_startdate).getDay();
					      var _jblx="";
					    <!--   if(_xq==0||_xq==6){
					        _jblx="周末加班";
					      }else{
					         var _end=_endday+" 08:00";
					         if(_end>=_enddate){
					           _jblx="早加班";
					         }
					          var _start=_startday+" 18:00";
					         if(_start<=_startdate){
					            _jblx="晚加班";
					         }
					      } -->
					    
					     var _fv={   "tableName" : "formson_0036",  
													"tableCategory" : "formson",  
													"updateData" : {},
													"updateRecordId" :  _records[num].recordId
												}
						_fv.updateData['field0011']={"showValue2":_jblx,"value":_jblx};	 
					    params.push(_fv); 
					    window.thirdPartyFormAPI.backfillFormControlData(params);
					  }
					  
					  
					}
					 
					 
					   
				    }
				    
			});
}
